package com.zghhost.codedemo.pulsar;

import org.apache.pulsar.client.admin.PulsarAdmin;

/**
 * @author guohua.zhang@zhaopin.com.cn
 * @Date 2019/6/20 17:52
 */
public class AdminClient {
    public static void main(String[] args)throws Exception{

        org.apache.pulsar.client.impl.conf.ClientConfigurationData config = new org.apache.pulsar.client.impl.conf.ClientConfigurationData();
        config.setUseTls(false);
        config.setServiceUrl("http://172.17.5.175:8080");

        PulsarAdmin admin = new PulsarAdmin("http://172.17.5.175:8080", config);
        System.out.println(admin.tenants().getTenants());
        System.out.println(admin.namespaces().getNamespaces(""));
//        admin.namespaces().createNamespace("ttttttt");
//        admin.topics().deletePartitionedTopic("persistent://middle/campus-position-merge/odp.org.add");
//        admin.topics().delete("middle/campus-position-merge/odp.org.add");
//        admin.topics().delete("middle/campus-position-merge/odp.org.add-partition-0");
//        admin.topics().delete("middle/campus-position-merge/odp.org.add-partition-1");
//        admin.topics().deletePartitionedTopic("persistent://middle/campus-position-merge/odp.org.add1");
//        admin.topics().createPartitionedTopic("persistent://middle/campus-position-merge/odp.org.add",2);
//        admin.topics().unload("persistent://middle/campus-position-merge/org.add");
//        System.out.println(admin.topics().getList("middle/campus-position-merge"));
//        System.out.println(admin.topics().getPartitionedTopicList("middle/campus-position-merge"));
    }
}
